package cn.itheima.dao;

import cn.itheima.domain.system.Permission;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * Created by millions on 2017/7/20.
 */
public interface PermissionRepository extends JpaRepository<Permission,Integer>{

    @Query("from Permission p inner join fetch p.roles r inner join fetch r.users u where u.id=?")
    List<Permission> findByUser(int id);
}
